#!/anaconda3/envs/Script/bin python3.8
# -*- coding: utf-8 -*-
# ---
# @Software: PyCharm
# @File: model.py
# @Author: AllenFu
# @Institution: NCHU, China
# @E-mail: nchufujianjian@126.com
# @Site: 数据库表实体类
# @Time: 11月 27, 2020
# ---
from sqlalchemy import Integer, FetchedValue, Text, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.testing.schema import Column

Base = declarative_base()
metadata = Base.metadata

class HtComment(Base):
    __tablename__='tb_comment'
    id = Column(Integer, primary_key=True)
    msg = Column(String(100), nullable=False, server_default=FetchedValue())
    user_id = Column(Integer)
    article_id =Column(Integer, nullable=False)
    add_time = Column(Integer, nullable=False)


class HtImgShard(Base):

    __tablename__ = 'tb_img_shared'

    id = Column(Integer, primary_key=True)
    uuid = Column(String(100), nullable=False, server_default=FetchedValue())
    imgString = Column(Text, nullable=False)
    index = Column(Integer, nullable=False)


class HtLog(Base):

    __tablename__ = 'tb_logs'

    id = Column(Integer, primary_key=True)
    type=Column(Integer, nullable=False, server_default=FetchedValue())
    level=Column(Integer, nullable=False, server_default=FetchedValue())
    data=Column(Text, nullable=False)
    create_time = Column(Integer, nullable=False)

    pass

class HtSuggest(Base):

    __tablename__ = 'tb_suggest'

    add_time = Column(Integer, nullable=False)
    id = Column(Integer, primary_key=True)
    users_id = Column(Integer, nullable=False)
    message = Column(String(255, 'utf8_unicode_ci'), nullable=False)


class HtUser(Base):

    __tablename__ = 'tb_user'

    id = Column(Integer, primary_key=True)
    name = Column(String(255, 'utf8_unicode_ci'), unique=True)
    email = Column(String(255, 'utf8_unicode_ci'), nullable=False, unique=True)
    tel = Column(String(20, 'utf8_unicode_ci'), unique=True)
    password = Column(String(255, 'utf8_unicode_ci'), nullable=False)
    status = Column(Integer, nullable=False)
    remember_token = Column(String(100, 'utf8_unicode_ci'))
    created_at = Column(Integer)
    updated_at = Column(Integer)
    url_path = Column(String(300, 'utf8_unicode_ci'))
    real_path = Column(String(300, 'utf8_unicode_ci'))